package com.kmzx.one.project.controller;

import com.kmzx.one.project.net.BaseResult;
import com.kmzx.one.project.others.dto.GreatBrand;
import com.kmzx.one.project.others.dto.GreatBrandMain;
import com.kmzx.one.project.service.BrandService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "快美甄选_[ 商品品牌_接口 ]")
@RestController
public class BrandController extends BaseController {


    @Autowired
    BrandService brandService;

    @ApiOperation(value = "1.精选品牌", notes = "精选品牌")
    @GetMapping(value = "brand/home")
    public BaseResult pickedBrand(String userId) {
        try {
            List<GreatBrand> detail = brandService.findGreatBrand(userId);
            BaseResult success = BaseResult.Builder.SUCC().initSuccData(detail);
            return success;
        } catch (Exception e) {
            return handleException(e);
        }
    }

    @ApiOperation(value = "2.品牌区，信息", notes = "品牌区，信息")
    @GetMapping(value = "brand/main")
    public BaseResult pickedBrandMain(String brandId, String userId) {
        try {
            GreatBrandMain detail = brandService.findBrandMainInfo(brandId, userId);
            BaseResult success = BaseResult.Builder.SUCC().initSuccData(detail);
            return success;
        } catch (Exception e) {
            return handleException(e);
        }
    }


}
